<h1>Sales Details</h1>
<p align="right"><a href="<?php echo site_url('people/purchaser/create_purchaser');?>">Add Purchaser</a></p>
<!--<div id="infoMessage"><?php echo $message;?></div>-->

<table class="table table-striped table-bordered" width="100%" id="example">
	<thead>
    <tr>
		<th>Invoice No</th>
		<th>Sale Date</th>
        <th>Customer Name</th>
        <th>Total Amount</th>
        <th>Total tax</th>
        <th>Toatal Discount</th>
		<th>Toatal Price</th>
		<th>Transaction Type</th>
		<th>Options</th>
	</tr>
    </thead>
	<?php foreach ($users as $user):?>
		<tr>
			<td><?php echo $user->invoice_no; ?></td>
			<td><?php  echo $user->date; ?></td>
            <td><?php  echo $user->customer_name; ?></td>
            <td><?php  echo $user->amount; ?></td>
            <td><?php  echo $user->total_disc; ?></td>
			<td><?php  echo $user->total_tax; ?></td>
			<td><?php  echo $user->total_price; ?></td>
           <td><?php  if($user->transaction_type == 0){echo "Cash"; }else{ echo "Debit"; }; ?></td>
		   <td><!--<?php echo anchor("sales/sales/edit_sale/".$user->id, 'Edit') ;?>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <a href="<?php echo site_url('sales/sales/delete_sale/').'/'.$user->id;?>" onclick="return confirm('Are you sure you want to DELETE this purchaser??')">Delete</a>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="<?php echo site_url('sales/sales/view_unique_sales/').'/'.$user->id.'/'.$user->invoice_no;?>" role="button" class="ccdc" data-toggle="modal">View details</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
<a href="<?php echo site_url('sales/sales/report/').'/'.$user->id.'/'.$user->invoice_no;?>" >Print</a>
	     </td>
		</tr>
	<?php endforeach;?>
</table>

<!--<p><a href="<?php echo site_url('auth/create_user');?>">Create a new user</a> | <a href="<?php echo site_url('auth/create_group');?>">Create a new group</a>
<a href="<?php echo site_url('auth/logout');?>">Logout</a>
</p>-->


    <!-- Button to trigger modal -->
    
     
    <!-- Modal -->
<script>   
  // subtasks edit scripts
		
$('.ccdc').click(function(event) {	
  event.preventDefault();
  $.get(this.href, function(html) {
  $(html).appendTo('body').modal(); 
  });
});
</script>